<template>
  <div>
    <div id="company-new">
      <section class="sec-01">
        <div class="back-holder">
          <div class="back-box" @click="goBack">
            <img src="../../assets/img/wx/mode/back.png"/>
          </div>
        </div>
        <div class="sec-01__title-box" >
          <head-line :txt="sec01Text" :txtStyle="sec01TextStyle"></head-line>
        </div>
        <div class="sec-01__content" >
          <dynamic-item :page="page"></dynamic-item>
        </div>
      </section>
    </div>
  </div>
</template>
<script type="text/ecmascript-6">
  import headLine from "./components/headline"
  import dynamicItem from "./components/dynamic-item"
  import Core from "core/core"
  export default {
    data() {
      return {
        sec01Text: "政策法规",
        sec01TextStyle: {
          "font-size": "20px",
          "color": "#ffffff"

        },
        page:[]
      }
    },
    mounted: function () {

    },
    components: {
      headLine,
      dynamicItem
    },
    methods: {
      goBack() {
        this.$router.back()
      },
      _getArticleList(type) {
        let that = this;
        Core.Api.Article.getArticleList(type, this.currentPage, this.pageSize)
          .then(res => {
            let count = res.count;
            let list = res.list;
            list.forEach(v => {
              let time = new Date(v.create_time * 1000).toLocaleDateString();
              let obj = {
                article: {
                  title: v.title,
                  timer: time
                },
                img: `http://enjoy-oss.oss-cn-hangzhou.aliyuncs.com/img/${v.img}`,
                id: v.id
              };
              that.page.push(obj);
              that.currentPage += 1;
            })
          })
          .catch(err => {
            console.log(err)
          })
      }
    },
    mounted() {
      this._getArticleList(2);
    }
  }
</script>
<style scoped lang="scss">
  #company-new {
    min-height: 100vh;
    width: 100vw;
    background: #000000;
    .sec-01 {
      color: #ffffff;
      position: relative;
      overflow: hidden;
      .back-holder {
        padding: 23px 14px;
        .back-box {
          width: 103px;
          height: 103px;
          padding: 23px 23px;
          img {
            width: 59px;
            height: 59px;
          }
        }

      }
      .sec-01__title-box {
        margin: 10% 0;
      }
      .sec-01__content{
        width: 100vw;
      }
    }
  }
</style>
